package com.ylxn.six;

import com.rabbitmq.client.Channel;
import com.ylxn.utils.RabbitMqUtils;

import java.nio.charset.StandardCharsets;
import java.util.Scanner;

/**
 * @author cenghaile
 * @version 1.0
 * 2021/7/1 7:12 下午
 **/
public class Direct_logs {
    public static final String EXCHANGE_NAME = "direct_log";

    public static void main(String[] args) throws Exception {
        Channel channel = RabbitMqUtils.getChannel();
        //  channel.exchangeDeclare(EXCHANGE_NAME,"fanout");
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            String next = scanner.next();
            channel.basicPublish(EXCHANGE_NAME,"",null,next.getBytes(StandardCharsets.UTF_8));
            System.out.println("生产者发送消息" + next);
        }
    }
}
